From: Philip Withnall Date: Tue, 8 Apr 2025 14:32:36 +0000 (+0100) Subject: breakManager: Rework notification urgency setting and presentation X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~139^2^2~10 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5ca183fe88eac6d251ace4be054f0865831e7086;p=gnome-shell.git breakManager: Rework notification urgency setting and presentation Move the setting of the notification’s urgency, and adding the notification to the queue, to beside where the notification is created. This avoids the potential for changing the urgency of an existing notification if none of the branches above are taken, and `this._notification` is non-empty. Spotted by Florian Müllner in https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3687#note_2405781. Signed-off-by: Philip Withnall Part-of: --- diff --git a/js/misc/breakManager.js b/js/misc/breakManager.js index d9b1cb3d6..65b740930 100644 --- a/js/misc/breakManager.js +++ b/js/misc/breakManager.js @@ -1100,6 +1100,7 @@ class BreakNotificationSource extends GObject.Object { title: titleText, body: bodyText, sound: null, + urgency: this._urgencyForBreakType(nextBreakType), allowDelay: true, allowSkip: true, allowTake: false, @@ -1228,10 +1229,12 @@ class BreakNotificationSource extends GObject.Object { title: titleText, body: bodyText, sound: null, + urgency: this._urgencyForBreakType(nextBreakType), allowDelay: true, allowSkip: false, allowTake: true, }); + this._source.addNotification(this._notification); this._scheduleUpdateState(BREAK_OVERDUE_TIME_SECONDS); } else if (breakDueAgo >= BREAK_OVERDUE_TIME_SECONDS && @@ -1248,10 +1251,12 @@ class BreakNotificationSource extends GObject.Object { title: _('Break Overdue'), body: bodyText, sound: null, + urgency: this._urgencyForBreakType(nextBreakType), allowDelay: true, allowSkip: false, allowTake: true, }); + this._source.addNotification(this._notification); this._scheduleUpdateState(updateTimeoutSeconds); } else if (this._previousState === BreakState.IN_BREAK) { @@ -1268,19 +1273,16 @@ class BreakNotificationSource extends GObject.Object { title: _('Break Interrupted'), body: bodyText, sound: null, + urgency: this._urgencyForBreakType(nextBreakType), allowDelay: false, allowSkip: false, allowTake: false, }); + this._source.addNotification(this._notification); this._scheduleUpdateState(updateTimeoutSeconds); } - if (this._notification) { - this._notification.urgency = this._urgencyForBreakType(this._manager.currentBreakType); - this._source.addNotification(this._notification); - } - break; }